<?php
declare(strict_types=1);

use Zms\Calculation\Calculation;
use function \Zms\Calculation\compute;
use function \Zms\Calculation\discount;

include_once dirname(__DIR__) . '/vendor/autoload.php';


$list = [
    '(3 + 5) * (8 - 2)',
    '7 + 3 * (2 + 3) - 9',
    '((4 + 6) * 2) / (1 + 3)',
    '(100 - 25 * 3) / 4',
    '15 + 7 * ((17 - 5) + 6)',
    '(2 + 3) * 4 - 6 / 2',
    '(1 + 2) * (4 + 5) / 3',
    '(10 - 2) * (7 + 3) / 4',
    '(8 / 4) * (5 + 5)',
    '(12 / 3) + (9 * 2) - 5',
    '((2 + 3) * (4 - 1)) / (6 - 3)',
    '(1 + 3) * (5 - 2) / (9 - 6)',
    '(2 + 2) * (3 + 3) / (6 + 6)',
    '(100 - 25) * (3 + 2) / 5',
    '(7 + 3) * (2 - 1) / (4 + 1)',
    '(9 * 3) - (8 / 4) + 5',
    '(15 - 5) / (2 + 3) * 4',
    '(2 * 2 + 3) * (4 - 1)',
    '(8 + 4) / (2 * 2) - 1',
    '(10 - 5) * (4 + 1) / 5',
    '(6 + 3) * (2 - 1) + 4',
    '(5 * 5) - (10 / 2) + 3',
    '(9 - 3) / (6 / 2) * 5',
    '(12 / 4) + (8 * 2) - 7',
    '(3 + 7) * (2 - 1) / (4 + 1)',
    '(20 - 5) / (15 / 3) + 2',
    '(3 * 3) + (9 / 3) - 4',
    '(16 / 4) * (5 + 5) / 10',
    '(2 + 4) * (6 - 3) / 9',
    '(8 - 2) * (7 + 1) / 4',
    '(5 + 5) * (2 - 1) / (3 + 2)',
    '(10 / 2) + (4 * 4) - 6',
    '(3 * 2 + 4) / (6 - 3)',
    '(9 + 3) / (6 / 2) - 1',
    '(7 - 2) * (5 + 5) / 10',
    '(12 - 3) * (4 + 2) / 9',
    '(2 * 5) - (8 / 4) + 7',
    '(14 / 2) + (3 * 3) - 5',
    '(6 + 4) * (3 - 1) / 4',
    '(15 - 3) / (12 / 4) + 2',
    '(4 * 4) + (8 / 2) - 9',
    '(3 + 3) * (2 - 1) / (6 + 3)',
    '(20 - 10) / (5 / 5) + 4',
    '(7 * 2) - (6 / 3) + 5',
    '(9 - 1) * (3 + 3) / 6',
    '(18 / 3) + (5 * 2) - 7',
    '(3 + 6) * (2 - 1) / (9 - 6)',
    '(10 - 2) * (5 + 5) / 10',
    '(14 / 7) + (8 * 2) - 3',
    '(2 + 2) * (3 + 3) / (6 - 3)',
    '(15 - 5) / (10 / 2) + 3',
    '(3 * 3) + (9 / 3) - 2',
    '(16 / 8) * (5 + 5) / 5',
    '(2 + 4) * (6 - 3) / 3',
    '(8 - 2) * (7 + 1) / 8',
    '(5 + 5) * (2 - 1) / (4 - 2)',
    '(10 / 5) + (4 * 4) - 2',
    '(3 * 2 + 4) / (6 - 2)',
    '(9 + 3) / (6 / 2) - 2',
    '(7 - 2) * (5 + 5) / 5',
    '(12 - 3) * (4 + 2) / 6',
    '(2 * 5) - (8 / 4) + 6',
    '(14 / 2) + (3 * 3) - 4',
    '(6 + 4) * (3 - 1) / 2',
    '(15 - 3) / (12 / 4) + 1',
    '(4 * 4) + (8 / 2) - 8',
    '(3 + 3) * (2 - 1) / (6 - 2)',
    '(20 - 10) / (5 / 5) + 3',
    '(7 * 2) - (6 / 3) + 4',
    '(9 - 1) * (3 + 3) / 3',
    '(18 / 3) + (5 * 2) - 6',
    '(3 + 6) * (2 - 1) / (9 - 3)',
    '(10 - 2) * (5 + 5) / 5',
    '(14 / 7) + (8 * 2) - 2',
    '(2 + 2) * (3 + 3) / (6 - 2)',
    '(15 - 5) / (10 / 2) + 2',
    '(3 * 3) + (9 / 3) - 3',
    '(16 / 8) * (5 + 5) / 2.5',
    '(2 + 4) * (6 - 3) / 2',
    '(8 - 2) * (7 + 1) / 4',
    '(5 + 5) * (2 - 1) / (3 - 1)',
    '(10 / 5) + (4 * 4) - 1',
    '((3.5 + -2.2) * (8.1 - 6)) / ((-4 + 2.7) * (-1 + 0.5))',
    '(7.5 + 3.2 * (2.1 + -3.5)) - 9.1',
    '(((4.5 + 6.2) * 2.1) / (1.5 + 3.3)) - (-2.5 + 1)',
    '((-100 + 25 * 3) / 4) + (-7.5 * 2)',
    '15.5 + 7.2 * ((17.3 - 5.4) + 6.1)',
    '((2.3 + -3.7) * 4.2) - 6.5 / 2.5',
    '(1.5 + 2.2) * ((4.1 + 5.2) / (3.2 + -1.5))',
    '((10.2 - 2.4) * (7.1 + 3.3)) / (4.5 - -1.2)',
    '((8.5 / 4.2) * (5.3 + 5.7)) - (-2.2 * 1.1)',
    '((12.5 / 3.5) + (9.4 * 2.1)) - 5.2',
    '((((2.5 + 3.2) * (4.1 - 1.7)) / ((6.2 + -2.8) * (-1.5 + 0.5))) + (-2.5 + 1.2)) * 3.3',
    '(-7.5 + 3.2 * ((2.1 + -3.5) * (4.2 + -1.8))) - (9.1 / (2.5 - 1.5))',
    '(((-4.5 + 6.2) * 2.1) / (1.5 + 3.3)) - ((-2.5 + 1.2) * ((2.2 + 3.1) / (4.2 - 1.5)))',
    '(((-100 + 25 * 3) / 4) + (-7.5 * 2)) * (((2.5 + 3.5) / (4.5 - 1.5)) - (1.2 + -0.5))',
    '15.5 + 7.2 * ((((17.3 - 5.4) + 6.1) * (2.5 - 1.5)) / ((4.2 + -2.8) * (3.5 + -1.5)))',
    '((2.3 + -3.7) * 4.2) - ((6.5 / 2.5) * ((-2.2 + 1.5) * (3.2 + -1.8)))',
    '(1.5 + 2.2) * (((4.1 + 5.2) / (3.2 + -1.5)) - ((2.2 + -1.5) * (3.1 + -2.8)))',
    '((10.2 - 2.4) * (7.1 + 3.3)) / (((4.5 - -1.2) * (2.5 + -1.5)) + (3.2 * -2.1))',
    '((8.5 / 4.2) * (5.3 + 5.7)) - ((-2.2 * 1.1) + ((2.5 + -1.5) * (3.2 + -2.8)))',
    '((12.5 / 3.5) + (9.4 * 2.1)) - ((5.2 + -2.1) * ((2.5 + -1.5) / (3.2 + -1.8)))',
    '((2.5 + 3.5) * (4.5 - 1.5)) / ((6.5 + -2.5) * (-1.5 + 0.5))',
    '(-7.5 + 3.2 * (2.1 + -3.5) * (4.2 + -1.8)) - 9.1',
    '(((4.5 + 6.2) * 2.1) / (1.5 + 3.3)) - (-2.5 + 1.2) * (2.2 + 3.1)',
    '((-100 + 25 * 3) / 4) + (-7.5 * 2) * ((2.5 + 3.5) / (4.5 - 1.5))',
    '15.5 + 7.2 * ((17.3 - 5.4) + 6.1) * (2.5 - 1.5)',
    '((2.3 + -3.7) * 4.2) - 6.5 / 2.5 * ((-2.2 + 1.5) * (3.2 + -1.8))',
    '(1.5 + 2.2) * ((4.1 + 5.2) / (3.2 + -1.5)) - ((2.2 + -1.5) * (3.1 + -2.8))',
    '((10.2 - 2.4) * (7.1 + 3.3)) / (4.5 - -1.2) - (3.2 * -2.1)',
    '((8.5 / 4.2) * (5.3 + 5.7)) - (-2.2 * 1.1) + ((2.5 + -1.5) * (3.2 + -2.8))',
    '((12.5 / 3.5) + (9.4 * 2.1)) - (5.2 + -2.1) * ((2.5 + -1.5) / (3.2 + -1.8))',
    '2*0',
    '2-0',
    '2+0'
];

echo PHP_EOL;
//四则运算
foreach ($list as $index => $item) {
    echo "【{$index}】:" . $item . ':' . PHP_EOL;
    echo Calculation::compute($item) . PHP_EOL;
    echo compute($item) . PHP_EOL . PHP_EOL;
}

//商品折扣
discount(32, 100);
